package spring.mvc.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import spring.mvc.model.User;

@Controller
@RequestMapping("/param")
public class ParamController {

    /**
     * 在控制器的参数列表中定义的变量的变量名和客户端传入的参数的参数名一致
     * SpringMVC自动将客户端提交的参数封装到对应的参数中
     * @param user_name
     * @return
     */

    @RequestMapping("/param1")
    public String paramDemo1(String user_name,int age){
        System.out.println(user_name);
        System.out.println(age+2);
        return "/succ.html";
    }
    @RequestMapping("param2")
    public String paramDemo2(User user){
        System.out.println(user);
        return "/succ.html";
    }
}
